//
//  BBUtils.swift
//  BBLinkiOSProject
//
//  Created by liuzhu on 2018/12/4.
//  Copyright © 2018 liuzhu. All rights reserved.
//

import UIKit
enum PhoneType: Int{
    case PHONE_6_8S = 10
    case PHONE_X = 15
    case PHONE_PLUS = 30
    case PHONE_MAX_XR = 40
}
class BBUtils: NSObject {

    class func timeStampToString(timeStamp:Int)->String {
        let timeSta:TimeInterval = Double(timeStamp/1000)
        let dfmatter = DateFormatter()
        dfmatter.dateFormat="yyyy-MM-dd HH:mm:ss"
        let date = NSDate(timeIntervalSince1970: timeSta)
        print(dfmatter.string(from: date as Date))
        return dfmatter.string(from: date as Date)
    }
    
    class func getPhoneType()->PhoneType{
        let size:CGSize = UIScreen.main.bounds.size
        if size.height > 560 && size.height < 680{
            return PhoneType.PHONE_6_8S
        }else if size.height > 680 && size.height < 740{
            return PhoneType.PHONE_PLUS
        }else if size.height > 740 && size.height < 820{
            return PhoneType.PHONE_X
        }else if size.height > 820 && size.height < 900 {
            return PhoneType.PHONE_MAX_XR
        }else{
            return PhoneType.PHONE_X
        }
    }
}
